home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / mac / progrmng / mlpmodul.sit / MacLogimoPlus Documentation / DEF1 Files / Storage.DEF < prev    next >
Encoding:
Modula Definition  |  1990-06-14  |  1016 b   |  28 lines  |  [TEXT/PMED]

  1. DEFINITION MODULE Storage;
  2.  
  3. (* This is the management module for the Modula-2 heap. *)
  4.  
  5. FROM SYSTEM IMPORT ADDRESS;
  6.  
  7. EXPORT QUALIFIED
  8.   ALLOCATE, DEALLOCATE, Available, CreateHeap, DestroyHeap;
  9.  
  10. PROCEDURE ALLOCATE (VAR addr : ADDRESS; amount : CARDINAL);
  11.  (* allocates the requested amount of memory (in bytes) and returns the *)
  12.  (* starting address . HALT if the amount is not available              *)
  13.  
  14. PROCEDURE DEALLOCATE (VAR addr : ADDRESS; amount : CARDINAL);
  15.  (* deallocates the given amount of memory (in bytes). HALT if the *)
  16.  (* memory hasn't been allocated by ALLOCATE                       *)
  17.  
  18. PROCEDURE Available (amount : CARDINAL) : BOOLEAN;
  19.  (* returns TRUE if an ALLOCATE of the specified amount (in bytes) *)
  20.  (* of memory would be possible                                    *)
  21.  
  22. PROCEDURE CreateHeap (amount : CARDINAL);
  23.  (* reserves an amount for the heap - takes it from the system *)
  24.  
  25. PROCEDURE DestroyHeap;
  26.   (* releases the heap - is also done automatically at program end *)
  27. END Storage.
  28.